Skip to content

Refactor callback oracles to return nothing#160

Merged
tmigot merged 1 commit into
JuliaSmoothOptimizers:mainfrom
odow:patch-1
Apr 29, 2026
Merged

Refactor callback oracles to return nothing#160
tmigot merged 1 commit into
JuliaSmoothOptimizers:mainfrom
odow:patch-1

Conversation

@odow

@odow odow commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

x-ref jump-dev/Ipopt.jl#540

This isn't needed for correctness, but it's good practice and it helps type stability.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the Ipopt callback “oracle” functions returned by set_callbacks so they consistently return nothing (rather than sometimes returning arrays), aligning with good Julia practice and improving type stability for these callbacks.

Changes:

  • Refactor eval_g and eval_grad_f from one-liners to function ... end blocks that explicitly return (nothing).
  • Ensure eval_jac_g and eval_h also explicitly return nothing after performing structure/value fills.
  • Remove the zeros(0) return path for the no-constraints case in eval_g.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tmigot tmigot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @odow for the PR! Does it fix #159 ?

@tmigot tmigot merged commit a2fdb39 into JuliaSmoothOptimizers:main Apr 29, 2026
18 of 19 checks passed
@odow

odow commented Apr 29, 2026

Copy link
Copy Markdown
Contributor Author

Yes, but I've also fixed it upstream in Ipopt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants